package ui;

import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

import logic.PerformTransactions;

/** Representing the gui for the account menu
 * @author Matthias
 * @author Niels Christian
 */
public class AccMenu extends JPanel {

	private final JLabel lbl_Header;
	private final JButton btn_AccountInfo;
	private final JButton btn_Deposit;
	private final JButton btn_Withdrawal;
	private final JButton btn_InterestRate;
	private final JButton btn_Logout;
	private final JButton btn_Back;
	private final JLabel lbl_Intro;
	private final JLabel logo_ATM;

	/**
	 * Contains the information/blueprint on labels and buttons
	 * Sets the window Dimensions
	 */
	public AccMenu() {

		setPreferredSize(new Dimension(600, 480));
		setLayout(null);

		lbl_Header = new JLabel("Account Menu");
		lbl_Header.setFont(new Font("SansSerif", Font.BOLD, 26));
		lbl_Header.setBounds(220, 31, 180, 21);
		add(lbl_Header);

		btn_AccountInfo = new JButton("Account Info");
		btn_AccountInfo.setActionCommand("" + PerformTransactions.ACCOUNT_INFO);
		btn_AccountInfo.setFont(new Font("SansSerif", Font.PLAIN, 16));
		btn_AccountInfo.setBounds(96, 139, 150, 50);
		add(btn_AccountInfo);

		btn_Deposit = new JButton("Deposit");
		btn_Deposit.setActionCommand("" + PerformTransactions.DEPOSIT);
		btn_Deposit.setFont(new Font("SansSerif", Font.PLAIN, 16));
		btn_Deposit.setBounds(385, 139, 150, 50);
		add(btn_Deposit);

		btn_Withdrawal = new JButton("Withdraw");
		btn_Withdrawal.setActionCommand("" + PerformTransactions.WITHDRAWAL);
		btn_Withdrawal.setFont(new Font("SansSerif", Font.PLAIN, 16));
		btn_Withdrawal.setBounds(96, 195, 150, 50);
		add(btn_Withdrawal);

		btn_InterestRate = new JButton("Interest Rate");
		btn_InterestRate.setActionCommand("" + PerformTransactions.INTERESTRATE);
		btn_InterestRate.setFont(new Font("SansSerif", Font.PLAIN, 16));
		btn_InterestRate.setBounds(385, 195, 150, 50);
		add(btn_InterestRate);

		btn_Logout = new JButton("Logout");
		btn_Logout.setActionCommand("" + PerformTransactions.LOGOUT);
		btn_Logout.setFont(new Font("SansSerif", Font.PLAIN, 16));
		btn_Logout.setBounds(385, 300, 150, 50);
		add(btn_Logout);

		btn_Back = new JButton("Back");
		btn_Back.setActionCommand("" + PerformTransactions.BACK);
		btn_Back.setFont(new Font("SansSerif", Font.PLAIN, 16));
		btn_Back.setBounds(96, 300, 150, 50);
		add(btn_Back);

		lbl_Intro = new JLabel("Please choose one of the following options");
		lbl_Intro.setFont(new Font("SansSerif", Font.BOLD, 16));
		lbl_Intro.setBounds(96, 107, 328, 21);
		add(lbl_Intro);
		
		logo_ATM = new JLabel("");
		logo_ATM.setIcon(new ImageIcon(AccMenu.class.getResource("/pic/LOGO Mini.png")));
		logo_ATM.setBounds(15, 15, 50, 50);
		add(logo_ATM);
	}
	
	/** Adds actionlisteners
	 * @param e
	 */
	public void addActionListener(final ActionListener e){
		btn_Logout.addActionListener(e);
		btn_AccountInfo.addActionListener(e);
		btn_Deposit.addActionListener(e);
		btn_InterestRate.addActionListener(e);
		btn_Withdrawal.addActionListener(e);
		btn_Back.addActionListener(e);
	}
	
	/**
	 * @return the logout button
	 */
	public JButton getBtnLogout(){
		return btn_Logout;
	}
	
	/**
	 * @return the back button
	 */
	public JButton getBtnBack(){
		return btn_Back;
	}
	
	/**
	 * @return the accountinfo button, used to get to the accountinfo ui
	 */
	public JButton getBtnAccountInfo(){
		return btn_AccountInfo;
	}
	
	/**
	 * @return the deposit button, used to get to the deposit ui
	 */
	public JButton getBtnDeposit(){
		return btn_Deposit;
	}
	
	/**
	 * @return the interest rate button, used to get to the interestrate ui
	 */
	public JButton getBtnInterestRate(){
		return btn_InterestRate;
	}
	
	/**
	 * @return the withdrawal button, used to get to the withdrawal ui
	 */
	public JButton getBtnWithdrawal(){
		return btn_Withdrawal;
	}
	
}